<layout name="Public/main_layout" />

<div class="page-header">

  <h2><span class="glyphicon glyphicon-list-alt glyphicon-head" aria-hidden="true"></span>栏目管理 <small class="pull-right"><a href="" ng-click="changeRoute('/category/add')" ><span class="glyphicon glyphicon-plus-sign glyphicon-head" aria-hidden="true"></span>添加栏目</a></small></h2>
  
</div>

  <div class="table-responsive">
	<!-- 在表格中标记collection -->
	<!-- 在table标签上注明循环变量line，默认为"line" -->
	<!-- table table-bordered table-striped table-hover table-condensed -->
	<table class="table" collection="category" line="cate" >
	  <thead>
		<tr>
		<td colspan="3" class="text-right">

		</td>

		<td colspan="3" class="text-right">
		
    <div class="input-group input-group-sm" style="margin:0 auto;">
      <span class="input-group-btn">
        <button class="btn btn-default" type="button"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
      </span>
      <input type="text" class="form-control" placeholder="Search for..." ng-model="search.$">
    </div><!-- /input-group -->	
	
		</td>		
		</tr>
		<tr class="bg-primary">
		<th>#</th>
		<th>ID</th>
		<th>分类名称</th>
		<th>封面图</th>
		<th>操作</th>
		<th>排序</th>
		</tr>
	  </thead>
	  <tfoot>
		<td colspan="3">
			<a ng-href="" class="btn btn-default btn-sm active" role="button" ng-model="allChecked" ng-click="allChecked=!allChecked">全选</a>
			<button type="button" class="btn btn-primary btn-sm" switch-some-bool="is_display:true" >显示</button>
			<button type="button" class="btn btn-danger btn-sm" switch-some-bool="is_display:false" >隐藏</button>
		</td>

		<td colspan="3" class="text-right">共 <strong>{{data.length}}</strong> 行</td>
	  </tfoot>
	  <tbody>
		<!-- 为了兼容ng与浏览器，_id取名mgid -->
		<!-- 每行在tr标签上标记_id值 -->
		<tr ng-repeat="cate in data | filter: search" ng-show="cate" mgid="{{cate.cat_id}}" ng-class="cate.level|levelClass">
		  <td style="width:10px;"><input type="checkbox" ng-checked="allChecked"></td>
		  <td>{{cate.cat_id}}</td>
		  <td>{{'&nbsp;&nbsp;&nbsp;&nbsp;'|levelRepeat:cate.level}}{{cate.cat_name}} <span class="text-info">[{{cate.level}}级菜单]</span></td>
		  <td>
			<img ng-src="__UPLOAD__/{{cate.cover_path}}" style="max-height:30px;" ng-if="cate.cover_path" />
			&nbsp;
		  </td>
		  <td> 
		  	<button type="button" class="btn btn-primary btn-xs" ng-if="cate.is_display" switch-bool="is_display" >显示</button>
			<button type="button" class="btn btn-danger btn-xs" ng-if="!cate.is_display" switch-bool="is_display" >隐藏</button>

			<!-- btn-default btn-primary btn-primary btn-info btn-warning btn-danger btn-cate-->
		  	<button type="button" class="btn btn-primary btn-xs btn-edit"  ng-click="edit(cate)">
				<span class="glyphicon glyphicon-edit"></span>编辑
		  	</button>	

		  	<button type="button" class="btn btn-danger btn-xs" ng-click="remove(cate)">删除</button> 
		  </td>
		  <td><input type="text" ng-model="cate.cat_order" style="width:65px;" change-by-id="cat_order" /></td>
		</tr>
	  </tbody>
	</table>
  </div>